package model;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

public class User extends Model
{
	private String	username;
	private String	password;
	private Role	role;

	public User()
	{

	}

	public static User getUser(Session session, String username, String password)
	{
		Criteria criteria = session.createCriteria(User.class);
		Criterion criterion = Restrictions.and(Restrictions.eq("username", username), Restrictions.eq("password", password));
		criteria.add(criterion);
		return (User) criteria.uniqueResult();
	}

	public String getUsername()
	{
		return username;
	}

	public void setUsername(String username)
	{
		this.username = username;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public Role getRole()
	{
		return role;
	}

	public void setRole(Role role)
	{
		this.role = role;
	}
}
